﻿using System.Collections;
using JetBrains.Annotations;
using MugenMvvmToolkit.Interfaces.ViewModels;

namespace MugenMvvmToolkit.Models
{
    /// <summary>
    ///     Represents the method that will handle events related to the edit object.
    /// </summary>
    /// <typeparam name="T">The type of model.</typeparam>
    /// <param name="viewModel">The specified view-model.</param>
    /// <param name="entity">The specified entity to edit.</param>
    public delegate void EntityHandler<in T>([NotNull]IEditableViewModel viewModel, T entity);

    /// <summary>
    ///     Represents the delegate that will handle events raised when a <c>ItemsSource</c> property changing.
    /// </summary>
    /// <typeparam name="T">The type of model.</typeparam>
    /// <param name="data">The new item source data.</param>
    public delegate void ItemsSourceChangeHandler<in T>([CanBeNull]T data) where T : IEnumerable;

    /// <summary>
    ///     Represents the method that used as a filter
    /// </summary>
    /// <typeparam name="T">The type of model.</typeparam>
    /// <param name="item">The item to filter.</param>
    /// <returns>The result of filter.</returns>
    public delegate bool FilterDelegate<in T>([CanBeNull]T item);
}